`
https://leetcode.cn/problems/transpose-matrix/
`

/**
 * @param {number[][]} matrix
 * @return {number[][]}
 */
var transpose = function (matrix) {
  const m = matrix.length, n = matrix[0].length

  const res = new Array(n).fill(null).map(() => new Array(m))

  for (let i = 0; i < m; i++) {
    for (let j = 0; j < n; j++) {
      res[j][i] = matrix[i][j]
    }
  }

  return res
};